import request from '@/utils/request'

// ==================== 社团浏览相关API ====================

// 查询社团列表  
export function listClub(query) {
  return request({
    url: '/campus/club/list',
    method: 'get',
    params: query
  })
}

// 查询社团详细
export function getClub(clubId) {
  return request({
    url: '/campus/club/' + clubId,
    method: 'get'
  })
}

// 获取热门社团
export function getPopularClubs() {
  return request({
    url: '/campus/club/popular',
    method: 'get'
  })
}

// ==================== 招新相关API ====================

// 查询招新信息列表
export function listRecruitment(query) {
  return request({
    url: '/campus/recruitment/list',
    method: 'get',
    params: query
  })
}

// 查询招新信息详细
export function getRecruitment(recruitmentId) {
  return request({
    url: '/campus/recruitment/' + recruitmentId,
    method: 'get'
  })
}

// ==================== 申请提交相关API ====================

// 学生提交申请
export function submitApplication(data) {
  return request({
    url: '/campus/application/submit',
    method: 'post',
    data: data
  })
}

// 新增申请
export function addApplication(data) {
  return request({
    url: '/campus/application',
    method: 'post',
    data: data
  })
}

// 增加兼容性映射，让apiSubmitApplication使用submitApplication
export const apiSubmitApplication = submitApplication;

// 修改申请
export function updateApplication(data) {
  return request({
    url: '/campus/application',
    method: 'put',
    data: data
  })
}

// 添加默认导出以确保模块正确导入
export default {
  listClub,
  getClub,
  getPopularClubs,
  listRecruitment,
  getRecruitment,
  submitApplication,
  addApplication,
  updateApplication
}